#ifndef UPDATER_H
#define UPDATER_H

#include <QtCore>

#include "package.h"

struct ServerInfo;

class Server;

class Updater : public QObject
{
  Q_OBJECT

public:
    Updater(QObject *parent = 0);

    void setServerInfo(const ServerInfo &info);
    bool connectServer();

    void setDownloadPath(const QString &path);
    void setRootPath(const QString &path);
    bool loadInstalledInfo(const QString &path);

    int downloadVersion(const QString &path, const QString &name);

    inline PackageData& data() { return pack; }

signals:
    void stateChanged(int state);

protected:
    QString rootPath, downPath;
    PackageData pack;

    Server *server;
};

#endif // UPDATER_H
